// Copyright 2019 Google
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
 * The CLSCrashReport protocol is deprecated. See the CLSReport class and the CrashyticsDelegate
 * changes for details.
 **/
@protocol FIRCLSCrashReport <NSObject>

@property(nonatomic, copy, readonly) NSString *identifier;
@property(nonatomic, copy, readonly) NSDictionary *customKeys;
@property(nonatomic, copy, readonly) NSString *bundleVersion;
@property(nonatomic, copy, readonly) NSString *bundleShortVersionString;
@property(nonatomic, readonly, nullable) NSDate *crashedOnDate;
@property(nonatomic, copy, readonly) NSString *OSVersion;
@property(nonatomic, copy, readonly) NSString *OSBuildVersion;

@end

/**
 * The CLSReport exposes an interface to the phsyical report that Crashlytics has created. You can
 * use this class to get information about the event, and can also set some values after the
 * event has occurred.
 **/
@interface FIRCLSReport : NSObject <FIRCLSCrashReport>

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

/**
 * Returns the session identifier for the report.
 **/
@property(nonatomic, copy, readonly) NSString *identifier;

/**
 * Returns the custom key value data for the report.
 **/
@property(nonatomic, copy, readonly) NSDictionary *customKeys;

/**
 * Returns the CFBundleVersion of the application that generated the report.
 **/
@property(nonatomic, copy, readonly) NSString *bundleVersion;

/**
 * Returns the CFBundleShortVersionString of the application that generated the report.
 **/
@property(nonatomic, copy, readonly) NSString *bundleShortVersionString;

/**
 * Returns the date that the report was created.
 **/
@property(nonatomic, copy, readonly) NSDate *dateCreated;

/**
 * Returns the os version that the application crashed on.
 **/
@property(nonatomic, copy, readonly) NSString *OSVersion;

/**
 * Returns the os build version that the application crashed on.
 **/
@property(nonatomic, copy, readonly) NSString *OSBuildVersion;

/**
 * Returns YES if the report contains any crash information, otherwise returns NO.
 **/
@property(nonatomic, assign, readonly) BOOL isCrash;

/**
 * You can use this method to set, after the event, additional custom keys. The rules
 * and semantics for this method are the same as those documented in FIRCrashlytics.h. Be aware
 * that the maximum size and count of custom keys is still enforced, and you can overwrite keys
 * and/or cause excess keys to be deleted by using this method.
 **/
- (void)setObjectValue:(nullable id)value forKey:(NSString *)key;

/**
 * Record an application-specific user identifier. See FIRCrashlytics.h for details.
 **/
@property(nonatomic, copy, nullable) NSString *userIdentifier;

/**
 * Record a user name. See FIRCrashlytics.h for details.
 **/
@property(nonatomic, copy, nullable) NSString *userName;

/**
 * Record a user email. See FIRCrashlytics.h for details.
 **/
@property(nonatomic, copy, nullable) NSString *userEmail;

@end

NS_ASSUME_NONNULL_END
